import java.util.Scanner;

public class ArrayReduce {
    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 56, 68, 89};
        Scanner scanner = new Scanner(System.in);
        while (true) {
            if (array.length == 1) {
                System.out.println("数组已经无法缩减，程序退出！");
                return;
            }
            System.out.println("是否缩减数组元素？y/n");
            String chooice = scanner.next();
            if (chooice.equals("y")) {
                int[] newArray = new int[array.length - 1];
                for (int i = 0; i < newArray.length; i++) {
                    newArray[i] = array[i];
                }
                array = newArray;
                for (int i = 0; i < array.length; i++) {
                    System.out.print(array[i] + "\t");
                }
                System.out.println();
            } else if (chooice.equals("n")) {
                return;
            }
        }
    }
}
